/*
 * greedy.h
 *
 *  Created on: 17 sept. 2013
 *      Author: the
 */

#ifndef GREEDY_H_
#define GREEDY_H_
#include "type.h"
#include "metric.h"
#include "init.h"
#include "sameFrequency.h"
#include "anh.h"
#include "dessin.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//Global extern variables
extern int nbOfNodes;		//Number of nodes
extern struct node* nodes;	//Array with the nodes
extern int nbOfRadios;		//Number of radios per node
extern int maxFreq;		//Number of orthogonal frequencies
extern int algorithm;		//Algorithm number used to allocate the frequencies
extern float	L;		//Length of a side of the observation window (LxL)
extern float	R;		//Radio scope of the nodes

int verifieContrainte(int id);

// The Anh
//Compute the conflict graph for a link bidirectional with a conflict at 3 hops.
int conflictGraphLink4(int id1, int id2, int frequency);
//Compute the conflict graph
int calculConflictGraphGreedy();
void affichageConflictReseaux();
//Fin The Anh

int trouverFreq(int id,int id2,int minConflict,int* bestFreq, int* bestRadioId, int* bestRadioId2);

int allocateGreedy(int id, int id2);

//Allocate the frequency to the nodes
void allocateFrequencyGreedy(int nbOfRoutes);



#endif /* GREEDY_H_ */
